package com.megvii.koala.net.creature;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.megvii.corelib.net.RequestParam;
import com.megvii.corelib.net.request.MegviiRequest;
import com.megvii.corelib.util.DateTimeUtil;
import com.megvii.koala.data.bean.CreatureBean;
import com.megvii.koala.net.Commands;

/**
 * Created by linyue on 16/1/11.
 */
public class AddCreatureRequest implements MegviiRequest
{
    @RequestParam
    public int subject_type;

    @RequestParam
    public String name;

    @RequestParam
    public String department;

    @RequestParam
    public String come_from;

    @RequestParam
    public String title;

    @RequestParam
    public String job_number;

    @RequestParam
    public String email;

    @RequestParam
    public int start_time;

    @RequestParam
    public int end_time;

    @RequestParam
    public int purpose;

    @RequestParam
    public String description;

    @RequestParam
    public String remark;

    @RequestParam
    public String phone;

    @RequestParam
    public int visit_notify;

    public AddCreatureRequest(){}

    public AddCreatureRequest(CreatureBean creature)
    {
        super();
        this.subject_type = creature.subject_type;
        this.name = creature.name;
        this.department = creature.department;
        this.come_from = creature.come_from;
        this.title = creature.title;
        this.job_number = creature.job_number;
        this.email = creature.email;
        this.start_time = (int) DateTimeUtil.toSTimestamp(creature.start_time);
        this.end_time = (int) DateTimeUtil.toSTimestamp(creature.end_time);
        this.purpose = creature.purpose;
        this.description = creature.description;
        this.remark = creature.remark;
        this.phone = creature.phone;
        this.visit_notify = creature.visit_notify ? 1 : 0;
    }


    @JsonIgnore
    @Override
    public String getCommand()
    {
        return Commands.ADD_CREATURE;
    }
}
